#ifndef _SIMULATOR_HPP
#define	_SIMULATOR_HPP
#include "Utilities.hpp"
#include "Types.hpp"
#include <string>
#include <fstream>
class Simulator
{
    public:
        Simulator(const std::string& Paramfile, const std::string& ParticleFile);
        ~Simulator()
        {
            delete [] particle_ids;
            delete [] cells_ids;
            delete [] masses;
	    delete [] inverse2Masses;
            delete [] velocities;
            delete [] positions;
            delete [] forces;
            delete [] oldForces;
        }
        bool readParticlesFile(const std::string& ParticleFile);
        void calcForces(const uint& fXboundaries,const uint& fYboundaries,const uint& fZboundaries);
        void updatePositions();
        void updateVelocities();
        inline void setCellsToMinus();
        void assembleCells();
	void sim(const uint& fXboundaries,const uint& fYboundaries,const uint& fZboundaries);
        void setBoundaries(const uint& fXboundaries,const uint& fYboundaries,const uint& fZboundaries);
    private:
        uint N_particles;
        uint N_cells;
        uint nCx,nCy,nCz;
        real xmin, ymin, zmin;
        real xmax, ymax, zmax;
	real lengthx, lengthy, lengthz;
        real r_cut, epsilon, sigma;
        real t_start, t_end, delta_t;
        int* particle_ids;
        int* cells_ids;
        real* masses;
	real* inverse2Masses;
        real4* velocities;
        real4* positions;
        real4* forces;
        real4* oldForces;
        std::string basename;
        int vis_space;
};

inline void Simulator::setCellsToMinus()
{
    for(uint i=0;i<N_cells;++i)
	cells_ids[i]=-1;
}

#endif	// _SIMULATOR_HPP 

